<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title>机构端</title>
        <script src="/Public/static/jquery-2.0.3.min.js"></script>
        <link rel="stylesheet" href="__PUBLIC__/Home/css/reset.css">
        <link rel="stylesheet" href="__PUBLIC__/Home/css/style.css">
	</head>

	<body class="agency_box contentBox pos_rel dpflxr">
		<include file="head" />

		<!-- 2.垂直导航 -->
		<div class="navColumn">
			<a href="{:U('Mechanism/news_index')}" <if condition="$cur eq 新闻管理">class="navColumnItem actived dpflxr pos_rel"<else />class="navColumnItem  dpflxr pos_rel"</if> data-type='1'>
				<div class="lineColumn pos_abs"></div>
				<label for="">新闻管理</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/class_index')}" <if condition="$cur eq 新闻分类">class="navColumnItem actived dpflxr pos_rel"<else />class="navColumnItem  dpflxr pos_rel"</if> data-type='2'>
				<div class="lineColumn pos_abs"></div>
				<label for="">新闻分类</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/activity_index')}" <if condition="$cur eq 活动管理">class="navColumnItem actived dpflxr pos_rel"<else />class="navColumnItem  dpflxr pos_rel"</if> data-type='3'>
				<div class="lineColumn pos_abs"></div>
				<label for="">活动管理</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/sign_up')}" <if condition="$cur eq 活动报名">class="navColumnItem actived dpflxr pos_rel"<else />class="navColumnItem  dpflxr pos_rel"</if> data-type='4'>
				<div class="lineColumn pos_abs"></div>
				<label for="">活动报名</label>
				<div class="rightArrow">
				</div>
			</a>
			
		</div>


		<!-- 3.垂直导航分类页面 -->		
		<!-- 3.1 活动管理 -->
		<div class="contentArea tabPage actived">
			<!-- 3.2.2 新增活动 -->
			<div id="addNews">
				<div class="caTitleBox dpflxr">
					<label for="" class="caTitle">新增新闻</label>
					
				</div>
				<form action="" method="POST">
				<div class="card switchPage ">
					<div class="dpflxr">
						<div class="contentItem  dpflxr ">
							<label for="" class="title">活动标题：</label>
							<div class="pos_rel">
								<input type="text" class="inputBox" name="title" value="{$info['title']}" placeholder="请输入活动标题" style="padding-right: 56px;"
									placeholder-style="font-size:16px;line-height:48px;color:#bfa;"/>
								<label class="pos_abs unit">0/15</label>
							</div>
							
						</div>
						<div class="contentItem  dpflxr">
							<label for="" class="title">排序：</label>
							<input type="text" class="inputBox" name="sort" value="{$info['sort']}" placeholder="请输入排序"
								placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />
						</div>
						<div class="contentItem  dpflxr">
							<label for="" class="title">活动人数：</label>
							<input type="text" class="inputBox" name="activity_number" value="{$info['activity_number']}" placeholder="请输入活动人数"
								placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />
						</div>
						<div class="contentItem  dpflxr">
							<label for="" class="title">绑定房源：</label>
							
							<select name="floor_id" class="selectBox">
								<volist name="floor_list" id="item">
									<option value="{$item['id']}" <if condition="$info['floor_id'] eq $item['id']">selected</if>>{$item['name']}</option>
								</volist>
							</select>
						</div>
					</div>
					<div class="contentItem  dpflxr pos_rel range">
						<label for="" class="title">活动时间：</label>
						<div class="pos_rel">
							<input type="date" class="dateSelectBox" value="{$info['start_time']}"name="start_time">
						</div>
						<label class="line">-</label>
						<div class="pos_rel">

							<input type="date" class="dateSelectBox" value="{$info['end_time']}" name="end_time">

						</div>
					</div>




					<div class="contentItem  dpflxr pos_rel range">
						<label for="" class="title">报名时间：</label>
						<div class="pos_rel">

							<input type="date" class="dateSelectBox" value="{$info['bs_time']}" name="bs_time">

						</div>
						<label class="line">-</label>
						<div class="pos_rel">
			
							<input type="date" class="dateSelectBox" value="{$info['be_time']}" name="be_time">
		
						</div>
					</div>
					<div class="contentItem upload2 dpflxrw">
						<label for="" class="title">活动图片：</label>
						<div class="image pos_rel im" id="cc">
							<if condition="$info['img'] neq ''"><img src="{$info['img_src']}"></if>
							<label for="" class="suggestion pos_abs">建议尺寸 750px*400px</label>
							
						</div>
					</div>
					
					<div class="contentItem editor  dpflxr">
						<label for="" class="title">活动详情：</label>
					
							<textarea style=" margin-left:12px;" id="content" name="content">{$info['content']}</textarea>
							{:hook('documentEditFormContent',array('name'=>'content','value'=>$info['content']))}
					</div>
					<input name="img" type="hidden" value="{$info['img']}">	
					<input type="hidden" name="id" value="{$info['id']}">
					<div><button type="submit"  class="ciBtn">确认</button></div>
					
					
					</div>
				
				</form>
			</div>
			
			
		</div>
		
	


	</body>
</html>
<script type="text/javascript">
	$("body").on('click','#cc',function(){
	// alert('123');
    var thisObj = $(this);
    var inputFile = document.createElement("input");
    inputFile.type = "file";
    inputFile.name = "file[]";
    inputFile.multiple = "multiple";
    inputFile.accept = "image/jpeg,image/jpg,image/png";
    inputFile.click();
    $(inputFile).change(function(){
        var files = inputFile.files;
        for(var i=0;i<files.length;i++){
            uploadImg(files[i],thisObj);
        }
    });
});
function uploadImg(file,thisObj){
    var formData = new FormData();
    formData.append('image', file);
    $.ajax({
        url: "{:U('Mechanism/uploadImg')}",
        type: "post",
        data: formData,
        dataType:"json",
        contentType: false,
        processData: false,
        mimeType: "multipart/form-data",
        success: function (data) {
            if(data.code == 0){
            　　console.log(data.info.imgid);
                var imgid=data.info.imgid;
            	$("input[name='img']").val(imgid);
            	var img=data.info.imgurl;
            	$('.im').html('<img src="'+img+'"/>');

　　　　　　　}
        },
    });
}
</script>